using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.U2D;
using UnityEngine.UIElements;


public class LoadResourcesArtExample : MonoBehaviour
{
   // public SpriteAtlas atlas;
    public Image item1;
    public Image item2;
    public string itemName1;
    public string itemName2;

    [Button("SetImage")]
    public void SetItemName()
    { 
        SpriteAtlas atlas = Resources.Load<SpriteAtlas>("Sprites/ItemIconAltas");  //图集名称
        Debug.Log( "检测到图片数量：" + atlas.spriteCount);
        if (atlas.GetSprite("Item_1") == null)
        {
            Debug.LogError($"Item {itemName1} not found");
        }
        item1.sprite = atlas.GetSprite(itemName1);
        item2.sprite = atlas.GetSprite(itemName2);
    }
}
